import React, { Component } from 'react';
import { Platform } from 'react-native';
import { Provider } from 'react-redux';
import { PersistGate } from 'redux-persist/integration/react';
import Roots from './Root';
import ConfigStore from './redux/ConfigStore';
import SplashScreen from 'react-native-splash-screen';
import { BaiduMapManager } from "react-native-baidu-map";

export default class App extends Component {

  UNSAFE_componentWillMount() {
    if (Platform.OS === 'ios') {
      BaiduMapManager.initSDK('dm4ZubOmwk7k58AI7NytIvAnIsR3S10u');
    }
  }

  componentDidMount() {
    SplashScreen.hide();
  }

  render() {
    let { store, persistor } = ConfigStore();
    return (
      <Provider store={store}>
        <PersistGate loading={null} persistor={persistor}>
          <Roots />
        </PersistGate>
      </Provider>
    )
  }

}